<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">

	<title>IFlySpeechRecognizerDelegate Protocol Reference</title>

	<link rel="stylesheet" href="../css/style.css">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
	<meta name="generator" content="appledoc 2.2.1 (build 1334)">
</head>
<body class="appledoc">
	<header>
		<div class="container" class="hide-in-xcode">
			
			<h1 id="library-title">
				<a href="../index.html">IFlyMSC </a>
			</h1>

			<p id="developer-home">
				<a href="../index.html">iflytek</a>
			</p>
			
		</div>
	</header>

	<aside>
		<div class="container">
			<nav>
				<ul id="header-buttons" role="toolbar">
					<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>

					<li id="on-this-page" role="navigation">
						<label>
							On This Page

							<div class="chevron">
								<div class="chevy chevron-left"></div>
								<div class="chevy chevron-right"></div>
							</div>

							<select id="jump-to">
	<option value="top">Jump To&#133;</option>
	
	<option value="overview">Overview</option>
	

	
	
	<option value="tasks">Tasks</option>
	
	

	
	

	

	
	<optgroup label="Instance Methods">
		
		<option value="//api/name/getAudioKey:">- getAudioKey:</option>
		
		<option value="//api/name/onBeginOfSpeech">- onBeginOfSpeech</option>
		
		<option value="//api/name/onCancel">- onCancel</option>
		
		<option value="//api/name/onEndOfSpeech">- onEndOfSpeech</option>
		
		<option value="//api/name/onError:">- onError:</option>
		
		<option value="//api/name/onEvent:arg0:arg1:data:">- onEvent:arg0:arg1:data:</option>
		
		<option value="//api/name/onResults:isLast:">- onResults:isLast:</option>
		
		<option value="//api/name/onVolumeChanged:">- onVolumeChanged:</option>
		
	</optgroup>
	
	
</select>
						</label>
					</li>
				</ul>
			</nav>
		</div>
	</aside>

	<article>
		<div id="overview_contents" class="container">
			<div id="content">
				<main role="main">
					<h1 class="title">IFlySpeechRecognizerDelegate Protocol Reference</h1>

					
					<div class="section section-specification"><table cellspacing="0"><tbody>
						<tr>
	<th>Conforms to</th>
	<td>NSObject</td>
</tr><tr>
	<th>Declared in</th>
	<td>IFlySpeechRecognizerDelegate.h</td>
</tr>
						</tbody></table></div>
					

                    
					
					<div class="section section-overview">
						<a title="Overview" name="overview"></a>
						<h2 class="subtitle subtitle-overview">Overview</h2>
						<p>语音识别协议
在使用语音识别时，需要实现这个协议中的方法.</p>
					</div>
					
					

					
					
					<div class="section section-tasks">
						<a title="Tasks" name="tasks"></a>
						

						
						

						<div class="task-list">
							<div class="section-method">
	<a name="//api/name/onError:" title="onError:"></a>
	<h3 class="method-title"><code><a href="#//api/name/onError:">&ndash;&nbsp;onError:</a></code>
<span class="task-item-suffix">required method</span></h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>识别结果回调
在进行语音识别过程中的任何时刻都有可能回调此函数，你可以根据errorCode进行相应的处理，
当errorCode没有错误时，表示此次会话正常结束；否则，表示此次会话有错误发生。特别的当调用
<code>cancel</code>函数时，引擎不会自动结束，需要等到回调此函数，才表示此次会话结束。在没有回调此函数
之前如果重新调用了<code>startListenging</code>函数则会报错误。</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)onError:(IFlySpeechError *)<em>errorCode</em></code></div>

		    
			
			<div class="method-subsection arguments-section parameters">
				<h4 class="method-subtitle parameter-title">Parameters</h4>
				<table class="argument-def parameter-def">
				
					<tr>
						<th scope="row" class="argument-name"><code>errorCode</code></th>
						<td><p>错误描述</p></td>
					</tr>
				
				</table>
			</div>
			

			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/onResults:isLast:" title="onResults:isLast:"></a>
	<h3 class="method-title"><code><a href="#//api/name/onResults:isLast:">&ndash;&nbsp;onResults:isLast:</a></code>
<span class="task-item-suffix">required method</span></h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>识别结果回调
在识别过程中可能会多次回调此函数，你最好不要在此回调函数中进行界面的更改等操作，只需要将回调的结果保存起来。
使用results的示例如下：</p>

<p><pre><code>
- (void) onResults:(NSArray <em>) results{
NSMutableString </em>result = [[NSMutableString alloc] init];
NSDictionary <em>dic = [results objectAtIndex:0];
for (NSString </em>key in dic){</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)onResults:(NSArray *)<em>results</em> isLast:(BOOL)<em>isLast</em></code></div>

		    
			
			<div class="method-subsection arguments-section parameters">
				<h4 class="method-subtitle parameter-title">Parameters</h4>
				<table class="argument-def parameter-def">
				
					<tr>
						<th scope="row" class="argument-name"><code>results</code></th>
						<td><p>-[out] 识别结果，NSArray的第一个元素为NSDictionary，NSDictionary的key为识别结果，sc为识别结果的置信度。</p></td>
					</tr>
				
					<tr>
						<th scope="row" class="argument-name"><code>isLast</code></th>
						<td><p>-[out] 是否最后一个结果</p></td>
					</tr>
				
				</table>
			</div>
			

			
			<div class="method-subsection return">
				<h4 class="method-subtitle parameter-title">Return Value</h4>
				<p>appendFormat:@&ldquo;%@&rdquo;,key];//合并结果
}
}
</code></pre></p>
			</div>
			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/onVolumeChanged:" title="onVolumeChanged:"></a>
	<h3 class="method-title"><code><a href="#//api/name/onVolumeChanged:">&ndash;&nbsp;onVolumeChanged:</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>音量变化回调
在录音过程中，回调音频的音量。</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)onVolumeChanged:(int)<em>volume</em></code></div>

		    
			
			<div class="method-subsection arguments-section parameters">
				<h4 class="method-subtitle parameter-title">Parameters</h4>
				<table class="argument-def parameter-def">
				
					<tr>
						<th scope="row" class="argument-name"><code>volume</code></th>
						<td><p>-[out] 音量，范围从0-30</p></td>
					</tr>
				
				</table>
			</div>
			

			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/onBeginOfSpeech" title="onBeginOfSpeech"></a>
	<h3 class="method-title"><code><a href="#//api/name/onBeginOfSpeech">&ndash;&nbsp;onBeginOfSpeech</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>开始录音回调
当调用了<code>startListening</code>函数之后，如果没有发生错误则会回调此函数。
如果发生错误则回调onError:函数</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)onBeginOfSpeech</code></div>

		    
			

			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/onEndOfSpeech" title="onEndOfSpeech"></a>
	<h3 class="method-title"><code><a href="#//api/name/onEndOfSpeech">&ndash;&nbsp;onEndOfSpeech</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>停止录音回调
当调用了<code>stopListening</code>函数或者引擎内部自动检测到断点，如果没有发生错误则回调此函数。
如果发生错误则回调onError:函数</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)onEndOfSpeech</code></div>

		    
			

			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/onCancel" title="onCancel"></a>
	<h3 class="method-title"><code><a href="#//api/name/onCancel">&ndash;&nbsp;onCancel</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>取消识别回调
当调用了<code>cancel</code>函数之后，会回调此函数，在调用了cancel函数和回调onError之前会有一个
短暂时间，您可以在此函数中实现对这段时间的界面显示。</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)onCancel</code></div>

		    
			

			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/getAudioKey:" title="getAudioKey:"></a>
	<h3 class="method-title"><code><a href="#//api/name/getAudioKey:">&ndash;&nbsp;getAudioKey:</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>返回音频Key</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)getAudioKey:(NSString *)<em>key</em></code></div>

		    
			
			<div class="method-subsection arguments-section parameters">
				<h4 class="method-subtitle parameter-title">Parameters</h4>
				<table class="argument-def parameter-def">
				
					<tr>
						<th scope="row" class="argument-name"><code>key</code></th>
						<td><p>音频Key</p></td>
					</tr>
				
				</table>
			</div>
			

			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/onEvent:arg0:arg1:data:" title="onEvent:arg0:arg1:data:"></a>
	<h3 class="method-title"><code><a href="#//api/name/onEvent:arg0:arg1:data:">&ndash;&nbsp;onEvent:arg0:arg1:data:</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>扩展事件回调
根据事件类型返回额外的数据</p>
			</div>
			
		    

			<div class="method-subsection method-declaration"><code>- (void)onEvent:(int)<em>eventType</em> arg0:(int)<em>arg0</em> arg1:(int)<em>arg1</em> data:(NSData *)<em>eventData</em></code></div>

		    
			
			<div class="method-subsection arguments-section parameters">
				<h4 class="method-subtitle parameter-title">Parameters</h4>
				<table class="argument-def parameter-def">
				
					<tr>
						<th scope="row" class="argument-name"><code>eventType</code></th>
						<td><p>事件类型，具体参见IFlySpeechEventType的IFlySpeechEventTypeVoiceChangeResult枚举。</p></td>
					</tr>
				
					<tr>
						<th scope="row" class="argument-name"><code>arg0</code></th>
						<td><p>arg0</p></td>
					</tr>
				
					<tr>
						<th scope="row" class="argument-name"><code>arg1</code></th>
						<td><p>arg1</p></td>
					</tr>
				
					<tr>
						<th scope="row" class="argument-name"><code>eventData</code></th>
						<td><p>事件数据</p></td>
					</tr>
				
				</table>
			</div>
			

			

			

			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">IFlySpeechRecognizerDelegate.h</code></p>
			</div>
			
			
		</div>
	</div>
</div>
						</div>
						
					</div>
					
					

                    
                    
          
				</main>

				<footer>
					<div class="footer-copyright">
						
						<p class="copyright">Copyright &copy; 2016 iflytek. All rights reserved. Updated: 2016-05-25</p>
						
						
						<p class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2.1 (build 1334)</a>.</p>
						
					</div>
				</footer>
			</div>
		</div>
	</article>

	<script src="../js/script.js"></script>
</body>
</html>